
<template>
  <div ref="animationContainer"></div>
</template>
 
<script>
import lottie from 'lottie-web';
 
export default {
  name: 'LottieAnimation',
  props: {
    path: {
      type: String,
      required: true
    }
  },
  mounted() {
    this.loadAnimation();
  },
  methods: {
    loadAnimation() {
      lottie.loadAnimation({
        container: this.$refs.animationContainer,
        renderer: 'svg',
        loop: true,
        autoplay: true,
        path: this.path // 动画JSON文件的路径
      });
    }
  }
};
</script>